CREATE OR REPLACE
TRIGGER PIECES_TRIGGER
BEFORE INSERT ON PIECES
FOR EACH ROW WHEN (NEW.PIECE_ID IS NULL)
BEGIN
	SELECT PIECES_SEQ.NEXTVAL
	INTO :NEW.PIECE_ID
	FROM DUAL;
END;